#include "mylab.h"
#include <QEvent>

MyLab::MyLab(QWidget *parent)
    : QLabel{parent}
{
    this->setAttribute(Qt::WA_Hover, true);
}

bool MyLab::event(QEvent *e)
{
    if(e->type() == QEvent::HoverEnter)
    {
        QPalette plet = this->palette();
        plet.setColor(QPalette::WindowText, Qt::red);
        this->setPalette(plet);
    }
    else if(e->type() == QEvent::HoverLeave)
    {
        QPalette plet = this->palette();
        plet.setColor(QPalette::WindowText, Qt::black);
        this->setPalette(plet);
    }

    return QLabel::event(e);
}

void MyLab::mouseDoubleClickEvent(QMouseEvent *event)
{
    Q_UNUSED(event);
    emit doubleClicked();
}


